package com.jt.controller;

import com.jt.pojo.User;
import com.jt.service.AxiosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/axios")
public class AxiosController {

    @Autowired
    private AxiosService axiosService;

    //添加用户操作
    @PostMapping("/saveUser")
    public String saveUser(@RequestBody User user){
        Integer integer = axiosService.saveUser(user);
        return null;
    }
    //查询用户列表操作
    @GetMapping("findUserList")
    public List<User> findUserList(){
        return axiosService.findUserList();
    }
    //修改用户操作
    @PutMapping("/updateUserById")
    public void updateUserById(@RequestBody User user){
        axiosService.updateUserById(user);
    }
    //删除数据库操作
    @DeleteMapping("/deleteUserById")
    public void deleteUserById(User user){
        axiosService.deleteUserById(user);
    }

    //查询操作
    @GetMapping("/userListByIn")
    public List<User> userListByIn(String str){
        return axiosService.userListByIn(str);
    }
}
